let str = "func";

function func1(str){
    console.log(str);
    return "func1";
}

function func2(str){
    console.log(str);
    return "func2";
}

function fail(){
    console.log("error");
}

let promise = new Promise(function(resolve, reject) {
    console.log("promise");
});

promise
.then(function(){
//    func1(str);
    console.log("hello");
});

let timeoutPromise = new Promise((resolve, reject) => {
//  setTimeout(function(){
//    resolve('Success!');
//  }, 2000);
    resolve("Success.");
});

timeoutPromise
.then(message => {
    console.log(message);
    resolve("here");
})
    .then(message =>{
        console.log(message);
    })
